package com.punai.customer.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;

import com.punai.customer.domain.vo.MergeGxVo;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.punai.common.annotation.Log;
import com.punai.common.core.controller.BaseController;
import com.punai.common.core.domain.AjaxResult;
import com.punai.common.enums.BusinessType;
import com.punai.customer.domain.CusSubpkItem;
import com.punai.customer.service.ICusSubpkItemService;
import com.punai.common.utils.poi.ExcelUtil;
import com.punai.common.core.page.TableDataInfo;

/**
 * 工序费用项Controller
 * 
 * @author zxw
 * @date 2022-12-04
 */
@RestController
@RequestMapping("/cus/subpkItem")
public class CusSubpkItemController extends BaseController
{
    @Autowired
    private ICusSubpkItemService cusSubpkItemService;

    /**
     * 查询工序费用项列表
     */
    @PreAuthorize("@ss.hasPermi('cus:subpkItem:list')")
    @GetMapping("/list")
    public TableDataInfo list(CusSubpkItem cusSubpkItem)
    {
        startPage();
        List<CusSubpkItem> list = cusSubpkItemService.selectCusSubpkItemList(cusSubpkItem);
        return getDataTable(list);
    }

    /**
     * 获取工序费用项详细信息
     */
    @PreAuthorize("@ss.hasPermi('cus:subpkItem:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") String id)
    {
        return AjaxResult.success(cusSubpkItemService.selectCusSubpkItemById(id));
    }

    /**
     * 新增工序费用项
     */
    @PreAuthorize("@ss.hasPermi('cus:subpkItem:add')")
    @Log(title = "工序费用项", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody CusSubpkItem cusSubpkItem)
    {
        return toAjax(cusSubpkItemService.insertCusSubpkItem(cusSubpkItem));
    }

    /**
     * 修改工序费用项
     */
    @PreAuthorize("@ss.hasPermi('cus:subpkItem:edit')")
    @Log(title = "工序费用项", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody CusSubpkItem cusSubpkItem)
    {
        return toAjax(cusSubpkItemService.updateCusSubpkItem(cusSubpkItem));
    }

    /**
     * 删除工序费用项
     */
    @PreAuthorize("@ss.hasPermi('cus:subpkItem:remove')")
    @Log(title = "工序费用项", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable String[] ids)
    {
        return toAjax(cusSubpkItemService.deleteCusSubpkItemByIds(ids));
    }

}
